<?
if(!isset($defincluded) || !$defincluded){
    include '../source/define.php';
}
?>
<?if(!strstr($_SERVER['REQUEST_URI'], 'login.php')){
    include '../source/mysql_connect.php';
}
if(!strstr($_SERVER['REQUEST_URI'], 'login.php') && !isset($_COOKIE['logged_in'])){
    header('location: login.php');
} elseif(isset($_COOKIE['logged_in'])){
    $user_id = $_COOKIE['logged_in'];
    $user = mysql_row_assoc("SELECT `id`, `login`, `status` FROM `user` WHERE `id`=?", $user_id);
}
if(strstr($_SERVER['REQUEST_URI'], 'users.php') && $user['status'] != 'su'){
    header('location: index.php');
}
header('Content-type: text/html; charset=utf-8');
 ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <link rel="stylesheet" type="text/css" href="<?=BASE_URL;?>style.css">
        <script src="<?=BASE_URL;?>source/jquery-1.4.js" type="text/javascript"></script>
    </head>
    <body bgcolor="#B0BDE8">
        <div class="container" style="width: 90%;">
            <?if(!strstr($_SERVER['REQUEST_URI'], 'login.php')):?>
                <div style="width: 100%; height: 25px;">
                    <span style="float:left; width: 8%; margin-left: 2%;"><a href="<?=BASE_URL;?>">На сайт</a></span>
                    <span style="float:left; width: 80%; text-align: center;">
                        &nbsp;&nbsp;&nbsp;<a href="<?=BASE_URL;?>admin/new_product.php">Добавить продукт</a>
                        &nbsp;&nbsp;&nbsp;<a href="<?=BASE_URL;?>admin/productslisting.php">Продукты</a>
                        &nbsp;&nbsp;&nbsp;<a href="<?=BASE_URL;?>admin/categories.php">Категории</a>
                        &nbsp;&nbsp;&nbsp;<a href="<?=BASE_URL;?>admin/price.php">Прайс-лист</a>
                        &nbsp;&nbsp;&nbsp;<a href="<?=BASE_URL;?>admin/news.php">Новости</a>
                        &nbsp;&nbsp;&nbsp;<a href="<?=BASE_URL;?>admin/files.php">Файлы</a>
                        <?if($user['status']=='su'):?>
                            &nbsp;&nbsp;&nbsp;<a href="<?=BASE_URL;?>admin/users.php">Управление аккаунтами</a>
                        <?endif;?>
                    </span>
                    <span style="float:left; width: 10%;"><?if($user_id):?><a href="<?=BASE_URL;?>admin/login.php?action=exit">Выход</a><?endif;?>&nbsp;</span>
                </div>
            <?endif;?>
            <div class="admin_main">